package com.pengtu.dao.app;

import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.pengtu.dao.hibernate.HibernateDao;
import com.pengtu.entity.app.Code;

/**
 * 角色对象的泛型DAO.
 * 
 * @author calvin
 */
@Repository
public class CodeDao extends HibernateDao<Code, String> {
	
	/**
	 * 
	 * getCodeByCategory:
	 * 适用: 根据category 与 codeId 查询对应的Code
	 * @param category
	 * @param codeId
	 * @return 
	 * @exception 
	 * @since  1.0.0
	 */
	public Code getCodeByCategory(Integer category,String codeId){
		Criterion categoryC = Restrictions.eq("category", category);
		Criterion codeIdC = Restrictions.eq("codeId", codeId);
		 return findUnique(categoryC,codeIdC);
	}

}